import http from '@/service/http'
import * as T from './types'
export const chatApi: T.IChatApi = {
  /**
   * 获取对话历史记录
   */
  getMessagesListById(params) {
    return http.post(
      '/langchainServer/api/langchain/chat/v1/get-conv-record',
      params
    )
  },
  getAiRes(params, callback, signal) {
    return http.getStreamData(
      '/langchainServer/api/langchain/chat/v1/chat',
      params,
      callback,
      signal
    )
  },
  knowlegeBaseChat(params, callback, signal) {
    return http.getStreamData(
      '/langchainServer/api/langchain/chat/v1/knowledge-base-chat',
      params,
      callback,
      signal
    )
  },
  getPromptsList() {
    return http.post('/langchainServer/api/langchain/chat/v1/get-prompt-list')
  },
  getConversationList() {
    return http.post('/langchainServer/api/langchain/chat/v1/get-conv-list')
  },
  getConversationId(params) {
    return http.post(
      '/langchainServer/api/langchain/chat/v1/get-conv-id',
      params
    )
  },
  likeAnswer(params) {
    return http.post(
      '/langchainServer/api/langchain/chat/v1/like-answer',
      params
    )
  },
  deleteConversation(params) {
    return http.post('/langchainServer/api/langchain/chat/v1/del-conv', params)
  }
}
